<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!-- <script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script> -->
<script type="text/javascript">
	$(function() {
		$("#menu").menu();
		
		$("#register").click(function(){
			location.href="registerView.do";
		});
		
		
		$("#login").click(function(){
			if($("#id").val().length==0){
				alert("아이디를 입력하세요!");
				return;
			}else if($("#password").val().length==0){
				alert("비밀번호를 입력하세요!");
				return;
			}
			$("#loginForm").submit();
		}); 
		
		$("#logoutBtn").click(function(){
			location.href="logout.do";
		});
		
		$("#myPage").click(function(){
			location.href="myPage.do?id=${sessionScope.mvo.id}";
		});
	});
</script>
<style type="text/css">
#menu {
	width: 200px;
	font-size: 13px;
}
</style>
<!-- ------------------------------------------------ -->
<c:choose>
<c:when test="${sessionScope.mvo==null }">
<form action="login.do" method="post" id="loginForm">
 <input type="text" id="id" name="id" placeholder="ID"><br>
 <input type="password" id="password" name="password" placeholder="PassWord"><br>
<input type="button" id="register" value="회원가입">
<input type="button" id="login" value="로그인"><br><br>
</form>
</c:when>
<c:otherwise>
ID : ${sessionScope.mvo.id}<br>
Name : ${sessionScope.mvo.name}<br>
Point : ${sessionScope.mvo.point}<br>
Grade : ${sessionScope.mvo.grade}<br>
<input type="button" value="로그아웃" id="logoutBtn">
<input type="button" value="마이페이지" id="myPage">
</c:otherwise>
</c:choose>


<!-- ------------------------------------------------ -->
<ul id="menu">
	<li><a href="${initParam.root }/board_newslist.do">News</a></li>
	<li><a href="${initParam.root }/getListboard.do">기술/Tip</a>
		<ul>
			<li><a href="${initParam.root }/findByCategory.do?category=java se">java se</a></li>
			<li><a href="${initParam.root }/findByCategory.do?category=spring">spring</a>
				<ul>
					<li><a href="${initParam.root }/findByCategory.do?category=di">di</a></li>
					<li><a href="${initParam.root }/findByCategory.do?category=aop">aop</a></li>
					<li><a href="${initParam.root }/findByCategory.do?category=mvc">mvc</a></li>
				</ul>
			</li>
		</ul>
	</li>
	<li><a href="${initParam.root }/qagetListBoard.do">QnA</a></li>
	<li><a href="${initParam.root }/board_disView.do">토론</a></li>
	<li><a href="${initParam.root }/board_fileList.do">자료실</a></li>
	<c:if test="${sessionScope.mvo!=null}">
	<li><a href="testMain.do">Test</a></li>
	</c:if>
	<c:if test="${sessionScope.mvo.grade==0}">
	<li>Manage(관리자전용)
		<ul>
			<li><a href="${initParam.root }/getAllMember.do">회원관리</a></li>
			<li><a href="${initParam.root }/getAllTest.do">Test관리</a></li>
		</ul>
	</li>
	</c:if>
</ul>
